<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/views/global/taglibs.jsp" %>
<!DOCTYPE>
<html>
  <head>
    <base href="<%=basePath %>">
    <title>COMMUNITY 社区交流</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	
<%@include file="/views/global/ShopInclude.jsp" %>
<link rel="stylesheet" type="text/css" href="static/css/page/internalTestMessage.css" />
<%@include file="/views/global/scripts.jsp" %>

  </head>
  
  <body>
  	<%@include file="/views/global/SearchBar.jsp" %>
 	<div class="centerarea">
		<!-- 左边菜单栏  -->
		<div class="message_menu">
			<ul>
				<c:forEach var="item" items="${adviceSubjectTypeMap }">
					<li><a href="javascript:void(0)" <c:if test="${searchVo.subjectType eq item.key }">class="msg_hover"</c:if>
						onclick="changeSubjectType(this, '${item.key}')">${item.value }</a></li>
				</c:forEach>
			</ul>
		</div>
		<!-- 左边菜单栏 结束  -->

		<!-- 右边留言区   -->
		<div style="float: left; width: 950px; margin-left: 50px;margin-bottom: 100px;">
			<ul>
				<li class="msg_title">
					<a style="width: 200px;" href="javascript:void(0)" onclick="changeUserType(this,'BUYER')" <c:if test="${'BUYER' eq searchVo.userType}"> class="title_hover"</c:if>>买家  BUYER</a>
					<a href="javascript:void(0)" onclick="changeUserType(this,'SELLER')" style="margin-left: 15px;" <c:if test="${'SELLER' eq searchVo.userType}"> class="title_hover"</c:if>>
						老外 FOREIGNER</a>
					<input type="button" id="btnNew" class="msg_fankui" value="+ 网站反馈   POST">
				</li>
				<c:forEach var="item" items="${entryList }">
					<li>
					<div class="search-content">
						<c:choose>
							<c:when test="${empty item.creatorHeader }"><img src="static/images/global/blank.png" class="chinese-head"/></c:when>
							<c:otherwise><img src="${fileServerBasePath }download/${item.creatorHeader }" class="chinese-head"/></c:otherwise>
						</c:choose>
						<span>
							<p class="chinese-name">${item.creator }</p>
							<p class="search-fensi">${item.title }</p>
						</span>
						<ul>
							<c:forEach var="image" items="${item.attachmentList }">
								<li><img src="${image }"></li>
							</c:forEach>
							<li>
								<div class='<c:choose><c:when test='${0 eq fn:length(item.attachmentList) }'>txtthree</c:when><c:when test="${2 gt fn:length(item.attachmentList) }">txtone</c:when><c:when test="${3 gt fn:length(item.attachmentList) }">txttwo</c:when><c:otherwise>txtthree</c:otherwise></c:choose>'>
									${item.content }<!-- <div class="text_dotted">…</div> -->
								</div>
							</li>
							<li class="dateli1">
								<p>
									&nbsp;READ & REPLY 查看 & 回复&nbsp;
									<a class="icon-unfold" href="javascript:void(0)" onclick="changestate(this)">
									</a>
								</p>
							</li>
							<li class="dateli2">
								<div class="search-datetime">
									<fmt:formatDate value="${item.gmtCreate }" pattern="yyyy-MM-dd HH:mm:ss"/>
									<!-- <span class="icon-msg"></span> -->
									<img alt="回复数量" src="static/images/page/internalTestMessage/icon-msg.jpg">
									${fn:length(item.replyList) }
									<a href="javascript:void(0)" onclick="newReply(this, '${item.id}')" class="icon-plane">
									</a>
								</div>
							</li>
						</ul>
							
						<ul id="${item.id}_hidetext" class="hidecontentul">
							<c:forEach var="reply" items="${item.replyList }" varStatus="state">
							<c:choose><c:when test="${state.last}">
							   <li>
								  <p class="txthide">
									&nbsp;${reply.creator }回复：${reply.content }&nbsp;
									<a href="javascript:void(0)" onclick="newReply(this, '${item.id}')" class="icon-plane">
									</a>
									<a href="javascript:void(0)" onclick="changestateup(this)">
									  <img src="static/images/page/internalTestMessage/icon-tipup.jpg" style="height: 15px; width: 17px;margin: 5px 17px 25px 0;float: right;">
							        </a>
								  </p>
							   </li>
							</c:when>
							<c:otherwise>
							    <li>
								  <p class="txthide">
									&nbsp;${reply.creator }回复：${reply.content }&nbsp;
									<a href="javascript:void(0)" onclick="newReply(this, '${item.id}')" class="icon-plane">
									</a>
								  </p>
							    </li>
							</c:otherwise></c:choose>
							
							</c:forEach>
						</ul>
					</div>
				</li>
				</c:forEach>
			</ul>
			<div class="pagination-simple categoryPagination">
				<form id="submitForm" name="submitForm" action="${actionPath }" method="post">
		 			<input type="hidden" name="subjectType" value="${searchVo.subjectType }"/>
		 			<input type="hidden" name="userType" value="${searchVo.userType }"/>
		 			
		 			<pagination:pagenav pageInfo="${pageInfo }" url="${actionPath }" formName="submitForm" className="pagination-prev"></pagination:pagenav>
		 		</form>
			</div>
		</div>
		<!-- 右边留言区 结束  -->
	</div>
	<div class="clearfix"></div>
 	
 	<%@include file="/views/global/footer.jsp" %>
  </body>
<script type="text/javascript">
$(document).ready(function(){
	$("#btnNew").click(function(){
		art.dialog.open('general/advice/newSubject', {
			cancel: function(){
				window.location.reload();
			}, lock: true, top: '5%', width: 750
		}, false);
	});
	$("#exit-txt").css("margin","-19px 0 0 28px");
	$("#globalSearchInput").css("height","29px").css("margin-left","10px");
	$("div.search-content:last").css("border","0px");
	
});

function newReply(target, id){
	art.dialog.open('general/advice/newReply?subjectId='+id, {
		close: function(){
			if(true == art.dialog.data("refresh.now")){
				document.submitForm.submit();
			}
		}, lock: true,top: '5%', width: 555
	}, false);
}

function changeUserType(target, userType){
	$("INPUT[name='userType']").val(userType);
	$("INPUT[name='pageIndex']").val(1);
	document.submitForm.submit();
}

function changeSubjectType(target, subjectType){
	$("INPUT[name='subjectType']").val(subjectType);
	$("INPUT[name='pageIndex']").val(1);
	document.submitForm.submit();
}

function changestate(target){
		var a=$(target).parent().parent();
		$(a).hide();
		$(a).next().show();
		$(a).prev().children("div").css({"overflow":"visible","height":"auto"});
		$(a).parent().next().show();
}

function changestateup(target){
		var a=$(target).parent().parent().parent();
		$(a).hide();
		$(a).prev().children("li.dateli1").show();
		$(a).prev().children("li.dateli2").hide();
		$(a).prev().children("li.dateli1").prev().children("div").css({"overflow":"hidden","height":"100px"});
}

</script>
</html>
